#
# @lc app=leetcode.cn id=1342 lang=python3
#
# [1342] 将数字变成 0 的操作次数
#

# @lc code=start
class Solution:
    def numberOfSteps(self, num: int) -> int:
        index=0
        if num==0:
            return 0
        while True:
            index+=1
            if num%2!=0:
                num-=1
                if num==0:
                    return index
            else:
                num = num/2

# @lc code=end

